Representation Types

<#5386#> A representation type allows an application to request different representations of the same resource value. For example, a color value might be represented either as a name string (``red''), a pixel value, an RGB triplet, an HSV triplet, etc. Only one representation for the resource value is actually stored in a resource database. Conversion functions may be invoked to return a representation type different from the one stored.

The representation type used for a contact resource is defined by the <#3515#>:type<#3515#> option of its resource specification in the <#3516#>defcontact<#3516#>. During contact initialization, a contact resource value read from a resource database by <#3517#>make-contact<#3517#> is automatically converted to its specified representation type.

CLUE performs resource representation type conversion by calling the <#3519#>convert<#3519#> function. CLUE defines methods for the <#3521#>convert<#3521#> function to handle all standard conversions. The standard representation type conversions provided by CLUE are shown in Figure~#fig:conversions#3522>.

In order to define a new representation type, the contact programmer must define methods for <#3524#>convert<#3524#> that handle the new representation type appropriately. Typically, <#3525#>convert<#3525#> methods will specify parameter specializers for <#3526#>type<#3526#> (e.g. <#4541#>(eql <#3527#>data-type<#3527#>)<#4541#>) and for <#3528#>value<#3528#> and will be defined only for each valid source/destination type pair.

<#4542#><#3529#>convert Method<#3529#><#4542#>

#tex2html_wrap_inline10545#

<#10546#>Figure<#10546#>: <#10547#>Standard Type Conversions<#10547#>
#figure3554#

=0 <#5396#>=0 <#5400#>